package com.hwtx.soa.registry;

import static com.hzgj.bcl.soa.registry.RegistryConstants.SERVICE_DOWN;
import static com.hzgj.bcl.soa.registry.RegistryConstants.SERVICE_PREFIX;

/**
 * Created by warning5 on 17-2-17.
 */
public class EtcdConstants {

    public static final String REFERENCE_PREFIX = "/reference";
    public static final String SERVICE_PROVIDERS = "providers";
    public static final String SERVICE_CONSUMES = "consumes";
    public static final String SERVICE_INFO = "info";
    public static final String ATTR_TIME = "time";
    public static final String ATTR_GROUP = "group";
    public static final String ATTR_AUTHOR = "author";


    public static String getServicePrefixPath(String name) {
        return SERVICE_PREFIX + "/" + name + "/" + SERVICE_PROVIDERS + "/";
    }

    public static String getReferencePath(String name, String host, int jmxPort) {
        return REFERENCE_PREFIX + "/" + name + "/" + SERVICE_CONSUMES + "/" + host + ":" + jmxPort;
    }

    public static String getServiceInfoPath(String name) {
        return SERVICE_PREFIX + "/" + name + "/" + SERVICE_INFO + "/";
    }

    public static String getDownServicePath(String name) {
        return SERVICE_PREFIX + "/" + name + "/" + SERVICE_DOWN + "/";
    }

}
